home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok40.lha
/
MischMasch
/
MischMasch.Mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
17KB
|
511 lines
MODULE MischMasch;
(*---------------------------------------------------------------------------
:Program. MischMasch
:Contents. from Scientific American "Computer Kurzweil"
:Version. 1.0
:History. Apr-90
:Author. Markus Peuckert
:Address. Schützenstr. 50, D-3550 Marburg, West-Germany,
:Copyright. PD
:Language. Modula-2
:Translator. M2Amiga V3.3d
---------------------------------------------------------------------------*)
FROM SYSTEM IMPORT INLINE, ADR, ADDRESS, FFP;
FROM Arts IMPORT Assert, TermProcedure, CurrentLevel;
FROM Intuition IMPORT ScreenPtr, WindowPtr, WindowFlags, WindowFlagSet,
ScreenFlags, ScreenFlagSet, customScreen,
IDCMPFlagSet, IDCMPFlags, CloseWindow, IntuiMessagePtr,
CloseScreen;
FROM Graphics IMPORT ViewModes, ViewModeSet, LoadRGB4, ViewPortPtr, SetRast,
RastPortPtr, SetAPen, RectFill, Move, Text, SetBPen;
FROM Exec IMPORT GetMsg, ReplyMsg;
FROM InOut IMPORT WriteString, ReadInt;
FROM Conversions IMPORT ValToStr;
FROM RandomNumber IMPORT RND;
FROM IntuiSup IMPORT CreateScreen, CreateWindow;
FROM Terminal IMPORT waitCloseGadget;
CONST WIDTH = 320;
HEIGHT = 256;
FTaste = 023H;
ESC = 045H;
MaxSeg = 100;
ges = 0;
inf = 1;
krnk = 2;
TYPE Segment = RECORD
zus, infi,
x, y, dx, dy : INTEGER;
END;
MatrixTyp= ARRAY [0..MaxSeg], [0..MaxSeg] OF Segment;
VAR Level : INTEGER;
scr : ScreenPtr;
win : WindowPtr;
rp : RastPortPtr;
vp : ViewPortPtr;
Msg : IntuiMessagePtr;
class : IDCMPFlagSet;
code : CARDINAL;
toggle : BOOLEAN;
DEPTH, MaxCol : INTEGER;
Z, Zt : MatrixTyp;
g, k1, k2,
MaxFeld, MaxInf : INTEGER;
FarbFak : FFP;
PROCEDURE FarbTest;
VAR i : INTEGER;
BEGIN
FOR i:=0 TO MaxCol-1 DO
SetAPen (rp, i);
RectFill (rp, 40+i*5, 0, 45+i*5, 10);
END
END FarbTest;
PROCEDURE Zeichne;
VAR x, y, col : INTEGER;
BEGIN
FOR x:=0 TO MaxFeld DO
FOR y:=0 TO MaxFeld DO
IF (Z[x][y].zus=ges) THEN
col:=0
ELSIF (Z[x][y].zus=krnk) THEN
col:=MaxCol-2
ELSIF (Z[x][y].zus=inf) THEN
col := INTEGER (FFP(Z[x][y].infi) / FarbFak);
IF (col<1) THEN col:=1 ELSIF (col>MaxCol-3) THEN col:=MaxCol-3 END
END;
SetAPen (rp, col);
RectFill (rp, Z[x][y].x, Z[x][y].y, Z[x][y].dx, Z[x][y].dy);
END END
END Zeichne;
PROCEDURE Kopi;
VAR x, y : INTEGER;
BEGIN
FOR x:=0 TO MaxFeld DO
FOR y:=0 TO MaxFeld DO
Z[x][y].infi := Zt[x][y].infi;
Z[x][y].zus := Zt[x][y].zus
END END
END Kopi;
PROCEDURE Colors1; (* $E- *)
BEGIN
INLINE (0FFFH, 000FH, 005FH, 00BFH, 00FFH, 00FBH, 00F5H, 00F0H,
04F0H, 09F0H, 0DF0H, 0FD0H, 0F80H, 0F40H, 0F00H, 0000H)
END Colors1;
PROCEDURE Colors2; (* $E- *)
BEGIN
INLINE (00B0H, 010EH, 020DH, 030CH, 040BH, 050AH, 0609H,
0708H, 0807H, 0906H, 0A05H, 0B04H, 0C03H, 0D02H, 0E01H,
0F00H, 0F10H, 0F20H, 0F30H, 0F40H, 0F50H, 0F60H, 0F70H,
0F80H, 0F90H, 0FA0H, 0FB0H, 0FC0H, 0FD0H, 0FE0H, 0FFFH, 0000H)
END Colors2;
PROCEDURE ToggleCol;
BEGIN
IF win#NIL THEN CloseWindow (win); win:=NIL; rp:=NIL END;
IF scr#NIL THEN CloseScreen (scr); scr:=NIL; vp:=NIL END;
IF NOT toggle THEN
DEPTH:=4;
scr := CreateScreen (WIDTH, HEIGHT, DEPTH, 0,1, ViewModeSet{}, NIL, NIL, NIL);
win := CreateWindow (0,0, WIDTH, HEIGHT,0,1,IDCMPFlagSet{rawKey,mouseButtons},
WindowFlagSet{borderless, activate, rmbTrap, noCareRefresh},
NIL, scr, NIL, NIL, customScreen);
MaxCol := 16;
FarbFak := FFP(MaxInf) / FFP(MaxCol-3);
vp := ADR (scr^.viewPort);
LoadRGB4 (vp, ADR(Colors1), MaxCol);
toggle:=TRUE;
ELSE
DEPTH:=5;
scr := CreateScreen (WIDTH, HEIGHT, DEPTH, 0,1,ViewModeSet{}, NIL, NIL, NIL);
win := CreateWindow (0,0, WIDTH, HEIGHT,0,1,IDCMPFlagSet{rawKey,mouseButtons},
WindowFlagSet{borderless, activate, rmbTrap, noCareRefresh},
NIL, scr, NIL, NIL, customScreen);
MaxCol := 32;
FarbFak := FFP(MaxInf) / FFP(MaxCol-3);
vp := ADR (scr^.viewPort);
LoadRGB4 (vp, ADR(Colors2), MaxCol);
toggle:=FALSE
END;
rp := win^.rPort;
SetRast (rp, MaxCol-1);
SetBPen (rp, MaxCol-1);
FarbTest;
Zeichne;
END ToggleCol;
PROCEDURE Process;
VAR xx, yy, AnzInf, AnzKrk, InfiSum : INTEGER;
Durch : LONGINT;
DuStr : ARRAY [0..5] OF CHAR;
err, quit : BOOLEAN;
BEGIN
Durch := 0; quit := FALSE; toggle:=FALSE;
REPEAT
INC (Durch);
ValToStr (Durch, FALSE, DuStr, 10, 6, " ", err);
SetAPen (rp, 30);
Move (rp, 5,275);
Text (rp, ADR(DuStr), 6);
FOR yy:=0 TO MaxFeld DO
FOR xx:=0 TO MaxFeld DO
IF ((xx>0) AND (yy>0) AND (xx<MaxFeld) AND (yy<MaxFeld)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx-1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx-1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx+1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx+1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy-1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy-1].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy+1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy+1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2)
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx-1][yy].zus=ges) THEN INC(InfiSum, Z[xx-1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx-1][yy].infi)
END;
IF (Z[xx+1][yy].zus=ges) THEN INC(InfiSum, Z[xx+1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx+1][yy].infi)
END;
IF (Z[xx][yy-1].zus=ges) THEN INC(InfiSum, Z[xx][yy-1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy-1].infi)
END;
IF (Z[xx][yy+1].zus=ges) THEN INC(InfiSum, Z[xx][yy+1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy+1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx=0) AND (yy>0) AND (yy<MaxFeld)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx+1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx+1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy-1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy-1].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy+1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy+1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx+1][yy].zus=ges) THEN INC(InfiSum, Z[xx+1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx+1][yy].infi)
END;
IF (Z[xx][yy-1].zus=ges) THEN INC(InfiSum, Z[xx][yy-1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy-1].infi)
END;
IF (Z[xx][yy+1].zus=ges) THEN INC(InfiSum, Z[xx][yy+1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy+1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx>0) AND (xx<MaxFeld) AND (yy=0)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx-1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx-1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx+1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx+1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy+1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy+1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx-1][yy].zus=ges) THEN INC(InfiSum, Z[xx-1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx-1][yy].infi)
END;
IF (Z[xx+1][yy].zus=ges) THEN INC(InfiSum, Z[xx+1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx+1][yy].infi)
END;
IF (Z[xx][yy+1].zus=ges) THEN INC(InfiSum, Z[xx][yy+1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy+1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx>0) AND (xx<MaxFeld) AND (yy=MaxFeld)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx-1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx-1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx+1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx+1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy-1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy-1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx-1][yy].zus=ges) THEN INC(InfiSum, Z[xx-1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx-1][yy].infi)
END;
IF (Z[xx+1][yy].zus=ges) THEN INC(InfiSum, Z[xx+1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx+1][yy].infi)
END;
IF (Z[xx][yy-1].zus=ges) THEN INC(InfiSum, Z[xx][yy-1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy-1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx=MaxFeld) AND (yy>0) AND (yy<MaxFeld)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx-1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx-1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy-1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy-1].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy+1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy+1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx-1][yy].zus=ges) THEN INC(InfiSum, Z[xx-1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx-1][yy].infi)
END;
IF (Z[xx][yy-1].zus=ges) THEN INC(InfiSum, Z[xx][yy-1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy-1].infi)
END;
IF (Z[xx][yy+1].zus=ges) THEN INC(InfiSum, Z[xx][yy+1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy+1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx=MaxFeld) AND (yy=0)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx-1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx-1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy+1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy+1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx-1][yy].zus=ges) THEN INC(InfiSum, Z[xx-1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx-1][yy].infi)
END;
IF (Z[xx][yy+1].zus=ges) THEN INC(InfiSum, Z[xx][yy+1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy+1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx=MaxFeld) AND (yy=MaxFeld)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx-1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx-1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy-1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy-1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx-1][yy].zus=ges) THEN INC(InfiSum, Z[xx-1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx-1][yy].infi)
END;
IF (Z[xx][yy-1].zus=ges) THEN INC(InfiSum, Z[xx][yy-1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy-1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx=0) AND (yy=MaxFeld)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx+1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx+1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy-1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy-1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx+1][yy].zus=ges) THEN INC(InfiSum, Z[xx+1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx+1][yy].infi)
END;
IF (Z[xx][yy-1].zus=ges) THEN INC(InfiSum, Z[xx][yy-1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy-1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END;
ELSIF ((xx=0) AND (yy=0)) THEN
IF (Z[xx][yy].zus = krnk) THEN (* krank *)
Zt[xx][yy].zus := ges;
Zt[xx][yy].infi := ges
ELSIF (Z[xx][yy].zus = ges) THEN (* gesund *)
AnzInf := 0; AnzKrk := 0;
IF (Z[xx+1][yy].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx+1][yy].zus = inf) THEN INC (AnzInf) END;
IF (Z[xx][yy+1].zus = krnk) THEN INC (AnzKrk) END;
IF (Z[xx][yy+1].zus = inf) THEN INC (AnzInf) END;
Zt[xx][yy].infi := (AnzInf DIV k1) + (AnzKrk DIV k2);
ELSIF (Z[xx][yy].zus = inf) THEN (* infiziert *)
InfiSum := 0; AnzInf := 0;
IF (Z[xx+1][yy].zus=ges) THEN INC(InfiSum, Z[xx+1][yy].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx+1][yy].infi)
END;
IF (Z[xx][yy+1].zus=ges) THEN INC(InfiSum, Z[xx][yy+1].infi) ELSE
INC (AnzInf); INC(InfiSum, Z[xx][yy+1].infi)
END;
INC (InfiSum, Z[xx][yy].infi); INC (AnzInf);
Zt[xx][yy].infi := (InfiSum DIV AnzInf) + g
END
END;
IF (Zt[xx][yy].infi <= ges) THEN
Zt[xx][yy].infi := ges;
Zt[xx][yy].zus := ges
ELSIF (Zt[xx][yy].infi >= MaxInf) THEN
Zt[xx][yy].infi:=MaxInf;
Zt[xx][yy].zus:=krnk
ELSE
Zt[xx][yy].zus := inf
END;
END (* xx *)
END; (* yy *)
Kopi;
Zeichne;
Msg := GetMsg (win^.userPort);
WHILE Msg#NIL DO
IF Msg#NIL THEN class:=Msg^.class; code:=Msg^.code; ReplyMsg (Msg);
IF (mouseButtons IN class) THEN END;
IF (rawKey IN class) THEN
CASE code OF
FTaste : ToggleCol |
ESC : quit:=TRUE |
ELSE
END END END;
Msg:=GetMsg (win^.userPort)
END
UNTIL quit;
END Process;
PROCEDURE RandomSet;
VAR xr, yr, infR : INTEGER;
BEGIN
FOR xr:=0 TO MaxFeld DO
FOR yr:=0 TO MaxFeld DO
infR := RND (MaxInf+1);
Z[xr][yr].infi := infR;
IF infR <= ges THEN
Z[xr][yr].infi := ges;
Z[xr][yr].zus := ges
END;
IF (infR > ges) AND (infR < MaxInf) THEN Z[xr][yr].zus := inf END;
IF infR >= MaxInf THEN
Z[xr][yr].infi := MaxInf;
Z[xr][yr].zus := krnk
END
END END
END RandomSet;
PROCEDURE SegInit;
VAR xx, yy : INTEGER;
BEGIN
FOR yy:=0 TO MaxFeld DO
FOR xx:=0 TO MaxFeld DO
WITH Z[xx][yy] DO
infi := ges; zus := ges;
x := 10+xx*2; dx := 11+xx*2; y := 20+yy*2; dy := 21+yy*2
END END END
END SegInit;
PROCEDURE Cleanup;
BEGIN
IF Level >= CurrentLevel() THEN
IF win#NIL THEN CloseWindow (win) END;
IF scr#NIL THEN CloseScreen (scr) END
END
END Cleanup;
PROCEDURE InitSys;
BEGIN
TermProcedure (Cleanup); Level := CurrentLevel();
DEPTH := 5;
scr := CreateScreen (WIDTH, HEIGHT, DEPTH, 0,1, ViewModeSet{}, NIL, NIL, NIL);
win := CreateWindow (0,0, WIDTH, HEIGHT,0,1,IDCMPFlagSet{rawKey,mouseButtons},
WindowFlagSet{borderless, activate, rmbTrap, noCareRefresh},
NIL, scr, NIL, NIL, customScreen);
vp := ADR (scr^.viewPort);
rp := win^.rPort;
MaxCol := 32;
FarbFak := FFP(MaxInf) / FFP(MaxCol-3);
LoadRGB4 (vp, ADR(Colors2), MaxCol);
SetRast (rp, MaxCol-1);
SetBPen (rp, MaxCol-1);
END InitSys;
PROCEDURE GetParams;
BEGIN
WriteString ("Max. Feldgröße : "); ReadInt (MaxFeld);
WriteString ("Max. Infizierungskoeffizient : "); ReadInt (MaxInf);
WriteString ("Infizierungsgeschwindigkeit (g) : "); ReadInt (g);
WriteString ("Widerstandsfähigkeit > Infizierte : "); ReadInt (k1);
WriteString ("WiderStandsfähigkeit > Kranke : "); ReadInt (k2);
IF MaxInf < MaxCol-2 THEN MaxInf:=MaxCol-1 END;
DEC (MaxInf);
IF k1<=0 THEN k1:=1 END;
IF k2<=0 THEN k2:=1 END;
DEC (MaxFeld);
END GetParams;
BEGIN (* HauptProgramm *)
waitCloseGadget := FALSE;
GetParams;
InitSys;
FarbTest;
SegInit;
RandomSet;
Zeichne;
Process;
END MischMasch.